package net.bac.sbe.common.sonar.validation;

import net.bac.sbe.common.xml.generalconfiguration.ConfigurationParametersType;

public class MetricValidationResult {
	private boolean overBaseLine = false;
	private boolean underBaseLine = false;
	private String metricId;
	private String itemName;
	private double metricValue = 0;
	private double lastValue = 0;
	private String messageFormat;
	
	
	public boolean isUnderBaseLine() {
		return underBaseLine;
	}
	public void setUnderBaseLine(boolean underBaseLine) {
		this.underBaseLine = underBaseLine;
	}
	public double getMetricValue() {
		return metricValue;
	}
	public void setMetricValue(double metricValue) {
		this.metricValue = metricValue;
	}
	public double getLastValue() {
		return lastValue;
	}
	public void setLastValue(double lastValue) {
		this.lastValue = lastValue;
	}
	public boolean isOverBaseLine() {
		return overBaseLine;
	}
	public void setOverBaseLine(boolean overBaseLine) {
		this.overBaseLine = overBaseLine;
	}
	public String getMetricId() {
		return metricId;
	}
	public void setMetricId(String metricId) {
		this.metricId = metricId;
	}
	public String getItemName() {
		return itemName;
	}
	public void setItemName(String itemName) {
		this.itemName = itemName;
	}
	public String getMessageFormat() {
		return messageFormat;
	}
	public void setMessageFormat(String messageFormat) {
		this.messageFormat = messageFormat;
	}
	
	public String toString(){
		return String.format(messageFormat, 
				ConfigurationParametersType.getInstance().getValue(metricId + "Name"), 
				itemName, 
				metricValue, 
				(overBaseLine)?">":(underBaseLine)?"<":"", 
				lastValue);
	}
}
